<html><head><title>Upload</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<?php
include "validate.php";
include "header.php";
?>
<h2>Upload Data</h2>
<h3>It is up to the sys admin to manage the SQL uploads.  This version reads them from <i>/var/www/uploads/</i></h3>
<?php
if (isset($_SESSION["message"]))
{
	echo "<h4><font color = 'red'>" . $_SESSION["message"] . "</font></h4>";
	$_SESSION['message'] = NULL;
	unset($_SESSION['message']);
}
?>
<form action = 'start_upload.php' method = 'post'>
<table name = 'sensor''><tr><td>Sensor</td><td>File Name</td><td>Type of File</td></tr><tr>
<td><select name = 'sensor' size = '6'>
<?php
$query = "	SELECT name AS name
		FROM sensor;";

$result = mysql_query($query);

while ($row = mysql_fetch_array($result))
{
	echo "<option>" . $row['name'] . "</option>";
}
?>
</select></td>
<td>
<?php
echo "<select name = 'file' size = '6'>";
echo passthru('ls /var/www/uploads | sed -e "s/^/<option>/;s/$/<\/option>/"');
echo "</select>";
?>
</td>
<td><select id = 'test' name = 'type' size = '6'><option>Dionaea</option>
</select>
</tr></td></tr></table>
<h4><font color = 'red'>Warning, this can take a long time! This won't be added to the database until an upload is done.<font color = 'red'></h4>
<input type = 'submit' value = 'Upload Data' /></form>
</body></html>
